#include "DefaultLogger.h"
#include "NezhaIFileSystem.h"

using namespace Nezha;

void DefaultConsoleLogger::post(const String& str, Logger::Level lv)
{
#ifdef NZOS_WIN32
	printf("%s\n", str.c_str());
#endif

#ifdef NZOS_IOS
	// TODO
#endif

#ifdef NZOS_ANDROID
	// TODO
#endif
}

void DefaultFileLogger::setFilePath(const String& path)
{
	mFilePath = path;

	if(mLogFile)
	{
		//IFileSystem::GetInterface()->
	}
}

void DefaultFileLogger::post(const String& str, Logger::Level lv)
{
	// TODO depending on filesystem
}

static DefaultConsoleLogger gsDefaultConsoleLogger;
static DefaultFileLogger gsDefaultFileLogger;

class DefaultLoggerTypeInitializer
{
public:
	DefaultLoggerTypeInitializer()
	{
		Logger::SetLoggerOutput(Logger::CONSOLE, &gsDefaultConsoleLogger);
		Logger::SetLoggerOutput(Logger::FILE, &gsDefaultFileLogger);

		int flag = Logger::CONSOLE | Logger::FILE;

		Logger::SetOutputFlag(flag);
	}
};

static DefaultLoggerTypeInitializer gsDefaultLoggerInitializer;